import axios from 'axios';
import _ from 'lodash';

const request = axios.create();

request.interceptors.response.use((ret: any) => {
  if (_.isEmpty(ret.data)) {
    return ret;
  }
  return ret.data;
});

const koding_request = axios.create({
  baseURL: '/koding',
});

koding_request.interceptors.response.use((ret: any) => {
  if (_.isEmpty(ret.data)) {
    return ret;
  }
  return ret.data;
});

export { koding_request };
export default request;
